Given an ellipse with unknown axes: Draw two parallel chords to the ellipse and bisect them (purple). Draw a line (blue) through the bisection points and extend it until it intersects the ellipse on both ends. Bisect the portion of the line within the ellipse. The center point of the line is the center of the ellipse. If the ellipse is somewhat rough, do this construction several times to get the best approximation. | |
Construct a circle centered on C with radius sufficient to intersect the ellipse in four places (blue). The chords of the circle that connect the intersection points are parallel to the axes of the ellipse. The four chords should form a rectangle. Alternatively, draw lines between opposite intersection points and bisect the resulting angles to find the axes. |
The general formula for a conic section is Ax2 + Bxy + Cy2 + Dx + Ey + F = 0. We eliminate F usually by dividing all the terms in the equation by F to make the final term 1.
Given five points (x1,y1); (x2,y2); (x3,y3); (x4,y4); (x5,y5), we can plug the coordinates in to the general formula to get five equations in five unknowns (A',B',C',D',E', where A' = A/f, etc.):
A'x12 + B'x1y1 + C'y12 + D'x1 + E'y1 + 1 = 0
A'x22 + B'x2y2 + C'y22 + D'x2 + E'y2 + 1 = 0
A'x32 + B'x3y3 + C'y32 + D'x3 + E'y3 + 1 = 0
A'x42 + B'x4y4 + C'y42 + D'x4 + E'y4 + 1 = 0
A'x52 + B'x5y5 + C'y52 + D'x5 + E'y5 + 1 = 0
We can now set up a family of determinants:
|x12 x1y1 y12 x1 y1| |1 x1y1 y12 x1 y1|
|x22 x2y2 y22 x2 y2| |1 x2y2 y22 x2 y2|
D = |x32 x3y3 y32 x3 y3| DA = |1 x3y3 y32 x3 y3|
|x42 x4y4 y42 x4 y4| |1 x4y4 y42 x4 y4|
|x52 x5y5 y52 x5 y5| |1 x5y5 y52 x5 y5|, etc.
We evaluate these using very tedious but very standard algebra, then we find A = DA/d, etc. Lots of spreadsheets will do determinants, or if you're coding this in a program, once you've written the code for one determinant, simple editing will rapidly generate the rest.
Once we have A', B', C', D', and E', what next?
We can solve for the axes, orientation and center of the ellipse but we need to develop the general equation of an ellipse in terms of those parameters first.
Start with an ellipse in standard Cartesian coordinates, then rotate it and translate it to get the general equation:
x2/a2 + y2/b2 = 1 or, clearing fractions
b2x2 + a2y2 = a2b2
Rotate by angle w:
x' = xcosw - ysinw y'= xsinw + ycosw
Theellipse becomes
b2(xcosw - ysinw)2 + a2(xsinw + ycosw)2 = a2b2
b2(x2cos2w -2xycoswsinw + y2sin2w) + a2(x2sin2w + 2xysinwcosw + y2cos2w) = a2b2
x2[b2cos2w + a2sin2w] + 2(a2 - b2)xysinwcosw + y2[b2sin2w + a2cos2w] = a2b2
Finally translate the ellipse to center at (h,k); x becomes x-h and y becomes y-k.
(x2 - 2hx +h2)[b2cos2w + a2sin2w] + 2(a2- b2)(x-h)(y-k)sinwcosw + (y2 - 2yk +k2)[b2sin2w + a2cos2w] = a2b2
Becomes:
In standard form, Ax2 + Bxy + Cy2 + Dx + Ey + F = 0
When we actually solve for our ellipse, we will have five sets of (x,y) coordinates and solve for the coefficients. We can then use the coefficients to find the parameters a, b, h, k, and w. But what will we do about the F term? We normalize the equations by dividing by F and reducing the constant term to 1. We will actually solve for A',B', etc. A = FA', etc.
In A, B and C, the unknowns are a, b and w.
We can write B = (a2 - b2)sin2w
Now cos2w = cos2w - sin2w = 2cos2w - 1 = 1 - 2sin2w. Hence
Thus A = [b2cos2w + a2sin2w] = [b2(1+ cos2w)/2 + a2(1 - cos2w)/2] = (a2 + b2)/2 - (a2 - b2)(cos2w)/2
Also C = [b2sin2w + a2cos2w] = [b2(1 - cos2w)/2 + a2(1+ cos2w )/2] = (a2 + b2)/2 + (a2 - b2)(cos2w)/2
Hence C - A = (a2 - b2)cos2w. Note also that C + A = a2 + b2
We can combine to get B/(C-A) = (a2 - b2)sin2w/(a2 - b2)cos2w = sin2w/cos2w = tan2w
Hence, tan2w = B/(C-A)
Since B/(C-A), we have FB'/(F(C'-A')) = B'/(C'-A'), so tan2w = B'/(C' - A')
It will be useful to have sin2w and cos2w in terms of A, B, and C.
Also, C + A = (a2 + b2) and B = (a2 - b2)sin2w. We now know w, so sin2w is known.
What will these be in terms of the normalized equations? Substituting A=FA', etc., we have
All that is left is to find the center of the ellipse (h,k). We have
Since B = (a2 - b2)sin2w = 2(a2 - b2)sinwcosW, we can see that:
Also, A = [b2cos2w + a2sin2w] and C = [b2sin2w + a2cos2w]. Hence:
Not only do we have two simultaneous equations in h and k, they're gratifyingly neat equations as well. We can eliminate the k terms by multiplying the top equation by -2C and the bottom equation by B:
Going back to the formula for D, we can solve for k
Interestingly enough, since both h and k are second degree in both numerator and denominator, the scaling factor F plays no role.
Finally, the constant term
F = h2[b2cos2w + a2sin2w] + 2(a2 - b2)(hk)sinwcosw + k2[b2sin2w + a2cos2w] - a2b2
We know
Access Crustal Materials Index
Access Crustal Movements Index
Access Crustal Materials Techniques Index
Return to Professor Dutch's Home Page
Created 17 June 2005, Last Update 24 May 2020